<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:sd="http://www.w3.org/ns/sparql-service-description#">
<head>
    <title resource="?this">{rdfs:label}</title>
    <link rel="comments" href="?discussion" />
    <link rel="version-history" href="?history" />
    <link rel="help" href="../../callimachus-for-web-developers#Datasource" target="_blank" title="Help" />
    <link href="../../callimachus-reference#SPARQL_Reference" target="_blank" title="Reference" />
    <link href="http://www.w3.org/TR/sparql11-query/" target="_blank" title="SPARQL Query Language" />
    <link href="http://www.w3.org/TR/sparql11-update/" target="_blank" title="SPARQL Update" />
    <script type="text/javascript">
        $(function(){
            var sd = "http://www.w3.org/ns/sparql-service-description#";
            if (!$('span[rel="sd:supportedLanguage"][resource="' + sd + 'SPARQL11Query"]').length) {
                $('.SPARQL11Query').hide();
            }
            if (!$('span[rel="sd:supportedLanguage"][resource="' + sd + 'SPARQL11Update"]').length) {
                $('.SPARQL11Update').hide();
            }
        });
    </script>
</head>
<body resource="?this">
    <h1 property="rdfs:label" />
    <div id="sidebar">
        <aside>
            <pre class="wiki" property="rdfs:comment" />
        </aside>
        <aside>
            <p>Query the database using the SPARQL language</p>
            <p>Namespace prefixes are optional and if omitted the default <a href="../../profile?view">SPARQL Profile</a> will be used</p>
            <p>Additional RDF graphs can be uploaded from the home folder</p>
            <p>To get started (if your database isn't too big) try listing some of the different types available in the database</p>
<pre>
SELECT DISTINCT ?type
WHERE {
  ?thing a ?type
}
ORDER BY ?type
LIMIT 50
</pre>
        </aside>
    </div>
    <form role="form" id="form" action="{?this}" method="GET">
        <fieldset>
            <textarea id="sparql" name="query" class="flex" required="required"
                onchange="$(form).find('button').removeAttr('disabled')"></textarea>
            <div resource="?this" typeof="sd:Service">
                <span rel="sd:endpoint" resource="?endpoint" />
                <span rel="sd:feature" resource="?feature" />
                <span rel="sd:inputFormat" resource="?inputFormat" />
                <span rel="sd:resultFormat" resource="?resultFormat" />
                <span rel="sd:supportedLanguage" resource="?support" />
            </div>
            <div class="form-group">
                <button id="evaluate" type="submit" class="btn btn-primary SPARQL11Query"
                    onclick="$('#form').attr('method','GET');$('#sparql').attr('name', 'query')">Evaluate Query</button>
                <button id="execute" type="submit" class="btn btn-primary SPARQL11Update"
                    onclick="$('#form').attr('method','POST');$('#sparql').attr('name', 'update')">Execute Update</button>
                <button type="button" onclick="history.back()" class="btn btn-default">Cancel</button>
            </div>
        </fieldset>
    </form>
</body>
</html>
